﻿using System.Linq;
using T.FAS.Runtime.Metadata.Entity.DataModel;

namespace T.FAS.Runtime.DataAccess.Common
{
    /// <summary>
    /// DB扩展方法
    /// </summary>
    public static class DBCommonExtension
    {
        public static string GetDefaultConfigKey(this Database db)
        {
            if (db == null || db.DatabaseConfigs == null)
                return string.Empty;
            return db.DatabaseConfigs.FirstOrDefault(c => c.IsDefault)?.ConfigKey;
        }
    }
}
